package config;

import POJO.People;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportResource;
import org.springframework.web.servlet.function.RouterFunction;
import org.springframework.web.servlet.function.ServerResponse;

import java.util.Date;

//@Import(People.class)
@Configuration       //告诉SpringBoot 这是一个配置类 => 配置文件
//@ImportResource("classpath:Bean.xml")
//@EnableConfigurationProperties(People.class)
public class myConfig {

    @Bean
    public People xiaoMing(){   //向容器中添加组件。以方法名作为组件的id，返回类型就是组件类型，返回的值就是组件在容器中的实例
        return new People("小明",21,new Date());
    }

   /* @ConditionalOnBean (name = "xiaoMing")  //有小明才能有李刚
    @Bean("123_LG")
    public People liGang(){
        return new People("李刚",22,new Date());
    }
*/
}
